package com.ruoyi.cfuser.rescue;

import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

@SpringBootTest
public class taskLister {

    @Resource
    private RabbitTemplate rabbitTemplate;

    @Test
    public void testDelay() throws InterruptedException {
// 1、发送订单消息：将来是在订单系统中，下单成功后，发送消息
        rabbitTemplate.convertAndSend("task_exchange", "task.msg", "订单信息： id=1");
// 2、打印倒计时10秒
        for (int i = 10; i > 0; i--) {
            System.out.println(i + "...");
            Thread.sleep(1000);
        }
    }
}
